function login() {
    let data = {
        username: $("#username").val(),
        password: $("#password").val(),
        code: $("#code").val()
    };
    $.ajax({
        url: '/login',
        data: data,
        type: "post",
        dataType: 'json',
        success: function (data) {
            if (data.result == "success") {
                localStorage.setItem("loginUsername", $("#username").val());
                localStorage.setItem("isLogin", "true");
                window.open("/html/back/manage.html");
            } else if (data.result == 'errorcode') {
                alert("验证码错误");
            } else {
                alert("输入用户名或密码错误");
            }
        }
    })
}